<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    
</body>
</html>
<script>
    /*
        思路：
        1：循环遍历数组  判断每个元素在数组中出现的次数 count计数
        2：如果count等于一的情况下 push到新数组中  
        
    */
    var arr = [1,2,6,3,4,3,5,3,6]
    var newarr = [];
    function removeSameValue(arr){
        arr.forEach((item,index) => {
            var count = 0;

            for(var i = 0; i < arr.length; i++){
                if(item == arr[i]){
                    count++;
                }
            }
            if(count == 1){
                newarr.push(item)
            }
        });
        //得到新数组
        console.log(newarr)
    }
    removeSameValue(arr)
</script>